namespace book {

  public class StateMachine {
    public StateMachine(Context context) { context_ = context; }
    public void  setState(State.Code code) { state_ = State.make(code); state_.onEnter(context_); }
    public State getState() { return state_; }

    public void handle(E_Comein        e) { state_ = state_.handle(e,context_); }
    public void handle(E_Repair        e) { state_ = state_.handle(e,context_); }
    public void handle(E_Lend          e) { state_ = state_.handle(e,context_); }
    public void handle(E_Expire        e) { state_ = state_.handle(e,context_); }
    public void handle(E_Extend        e) { state_ = state_.handle(e,context_); }
    public void handle(E_Return        e) { state_ = state_.handle(e,context_); }
    public void handle(E_Reserve       e) { state_ = state_.handle(e,context_); }
    public void handle(E_Cancelreserve e) { state_ = state_.handle(e,context_); }
    public void handle(E_Repaired      e) { state_ = state_.handle(e,context_); }
    public void handle(E_Dispose       e) { state_ = state_.handle(e,context_); }

    private Context context_;
    private State   state_;
  };

}
